<template>
  <div class="main-bg">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"
             label-width="68px">
      <el-row>
        <el-col :span="6">
          <el-form-item label="商品名称" prop="appletUserName">
            <el-input v-model="queryParams.appletUserName" placeholder="请输入用户昵称" clearable
                      @keyup.enter.native="handleQuery" />
          </el-form-item>
        </el-col>

        <el-col :span="6">
          <el-form-item label="所属类目" prop="appletUserPhone">
            <el-input v-model="queryParams.appletUserPhone" placeholder="请输入手机号" clearable
                      @keyup.enter.native="handleQuery" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table
      :data="tableData"
      stripe
      v-loading="loading"
      style="width: 100%;margin-top: 10px">
      <el-table-column
        type="index"
        align="center"
        label="序号"
        width="50">
      </el-table-column>
      <el-table-column
        prop="name"
        align="center"
        width="150px"
        label="商品名称">
      </el-table-column>
      <el-table-column
        prop="phone"
        align="center"
        label="所属类目">
      </el-table-column>
      <el-table-column
        prop="soreStatus"
        align="center"
        label="售卖者">
      </el-table-column>
      <el-table-column
        prop="cardNum"
        align="center"
        label="价格">
      </el-table-column>

      <el-table-column
        prop="cardNum"
        align="center"
        label="举报次数">
        <template slot-scope="scope">
          <el-button type="text" @click="checkCard(scope.row.id)">{{scope.row.cardNum}}</el-button>
        </template>
      </el-table-column>
      <el-table-column
        prop="status"
        align="center"
        label="商品状态">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.goods_status" :value="scope.row.status"/>
        </template>
      </el-table-column>
      <el-table-column
        prop="creatTime"
        align="center"
        label="注册时间">
      </el-table-column>
      <el-table-column label="操作" align="center"  width="250px">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="primary"
            @click="handleSee(scope.row)">查看</el-button>
          <el-button
            size="mini"
            type="danger"
            v-if="scope.row.status==0"
            @click="banBtn(scope.row)">下架</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!--    查看详情弹窗-->
    <el-dialog title="用户详情" :visible.sync="seeFlag">
      <el-descriptions title="用户信息"  :column="2" border style="margin-top: 20px;color: #1890ff;">
        <el-descriptions-item label="用户id">{{userData.appletUserId}}</el-descriptions-item>
        <el-descriptions-item label="用户名">{{userData.appletUserName}}</el-descriptions-item>
        <el-descriptions-item label="手机号">{{userData.appletUserPhone}}</el-descriptions-item>
      </el-descriptions>
    </el-dialog>
    <el-dialog title="举报详情" :visible.sync="dialogCard">
      <el-table :data="cardData">
        <el-table-column property="date"  align="center" label="举报人id"></el-table-column>
        <el-table-column property="name"  align="center" label="举报人"></el-table-column>
        <el-table-column property="address"  align="center" label="举报原因"></el-table-column>
        <el-table-column property="address"  align="center" label="举报时间"></el-table-column>
      </el-table>
    </el-dialog>
  </div>

</template>

<script>



export default {
  name: "index",
  dicts: ['goods_status'],
  data(){
    return{
      dialogCard:false,
      cardData:[{

      }],
      loading:false,
      seeFlag:false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      tableData: [{
        name:'商品1',
        cardNum:'2',
        phone:'1级/2级/3级',
        status:0,
        soreStatus:0,
        creatTime:'2023-01-01'
      },{
        name:'商品2',
        cardNum:'3',
        phone:'1级/2级/3级',
        status:1,
        soreStatus:1,
        creatTime:'2023-01-01'
      }],
      userData:{},
      total:10,
    }
  },
  mounted() {
    this.getList()
  },
  methods:{
    checkCard(){
      this.dialogCard=true
    },
    banBtn(row){


    },








    handleSee(row){
      this.seeFlag=true
      this.userData={...row}
    },
    getList(){

      // this.loading = true;
      // getUserParamsPageList(this.queryParams).then(response => {
      //   this.tableData = response.data?response.data.rows:[];
      //   this.total=response.data.total
      //   this.loading = false;
      // });
    },



    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },

  }
}
</script>
<style scoped lang="scss">

</style>
